/*
 * Copyright 2009 Armando Blancas
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package tests.taskgraph.tasks.io;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;

import taskgraph.reflect.Field;


/**
 * Sample class for customer info.
 * 
 * <p>This class follows the Java Persistence API and thus it may be used for
 * automated persistence or retrieval of customer data from a SQL database
 * or a custom source, such as a flat file source task.
 * 
 * @author Armando Blancas
 * @see taskgraph.tasks.io.ReadDelimitedTextFile
 * @see taskgraph.tasks.io.WriteDelimitedTextFile
 */
@Entity
public class Customer implements Serializable {
	
	/**
	 * Customer class version number.
	 */
	private static final long serialVersionUID = 1L;
	
	private long id;
	private String firstName;
	private String lastName;
	private char middleInitial;
	private Date dob;
	private double balance;
	
	/**
	 * Default constructor.
	 */
	public Customer() {
		// do nothing
	}
	
	/**
	 * Creates a Customer instances with all fields initialized.
	 * 
	 * @param id            The value for First Name.
	 * @param firstName     The value for First Name.
	 * @param lastName      The value for Last Name.
	 * @param middleInitial The value for Middle Initial.
	 * @param dob           The value for Date of Birth.
	 * @param balance       The value for Balance.
	 */
	public Customer(final long id,
		            final String firstName,
		            final String lastName,
		            final char middleInitial,
		            final Date dob,
		            final double balance) {
		setId(id);
		setFirstName(firstName);
		setLastName(lastName);
		setMiddleInitial(middleInitial);
		setDob(dob);
		setBalance(balance);
	}
	
	/**
	 * @return the id
	 */
	@Field(position = 1) 
	public long getId() {
		return id;
	}
	
	/**
	 * @param id the id to set
	 */
	public void setId(final long id) {
		this.id = id;
	}
	
	/**
	 * @return the firstName
	 */
	@Field(position = 2)
	public String getFirstName() {
		return firstName;
	}
	
	/**
	 * @param firstName the firstName to set
	 */
	public void setFirstName(final String firstName) {
		this.firstName = firstName;
	}
	
	/**
	 * @return the lastName
	 */
	@Field(position = 3)
	public String getLastName() {
		return lastName;
	}
	
	/**
	 * @param lastName the lastName to set
	 */
	public void setLastName(final String lastName) {
		this.lastName = lastName;
	}
	
	/**
	 * @return the middleInitial
	 */
	@Field(position = 4)
	public char getMiddleInitial() {
		return middleInitial;
	}
	
	/**
	 * @param middleInitial the middleInitial to set
	 */
	public void setMiddleInitial(final char middleInitial) {
		this.middleInitial = middleInitial;
	}
	
	/**
	 * @return the dob
	 */
	@Field(position = 5)
	public Date getDob() {
		return dob;
	}

	/**
	 * @param dob the dob to set
	 */
	public void setDob(Date dob) {
		this.dob = dob;
	}

	/**
	 * @return the balance
	 */
	@Field(position = 6)
	public double getBalance() {
		return balance;
	}
	
	/**
	 * @param balance the balance to set
	 */
	public void setBalance(final double balance) {
		this.balance = balance;
	}

}
